package com.hctforgreen.greenservice.utils;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

/**
 * 下载存储路径 存储Util
 * 
 * @author denghb
 * 
 */
public class SelectStoreUtil {

	/**
	 * 保存下载路径
	 * 
	 * @param position
	 *            0扩展sd卡 1标准sd卡
	 * 
	 * @param activity
	 */
	public static void save(Context context, int position) {
		

		SharedPreferences sharedPreferences = context.getSharedPreferences(
				HctConstants.DOWNLOAD_STORE_POSITION_FILE_NAME,
				Context.MODE_MULTI_PROCESS);
		Editor editor = sharedPreferences.edit();
		editor.putInt(HctConstants.DOWNLOAD_STORE_POSITION_KEY_VALUE, position);
		editor.commit();
	}

	/**
	 * 获取下载存储路径
	 * 
	 * @param activity
	 * @return store position 0内部存储 1扩展sd卡
	 * 
	 */
	public static int get(Context context) {

		SharedPreferences sharedPreferences = context.getSharedPreferences(
				HctConstants.DOWNLOAD_STORE_POSITION_FILE_NAME,
				Context.MODE_MULTI_PROCESS);
		return sharedPreferences.getInt(
				HctConstants.DOWNLOAD_STORE_POSITION_KEY_VALUE, 0);
	}

}
